import 'package:flutter/material.dart';
import 'package:flutter_demo/widget/search.dart';
import 'widget/cards.dart';

class QueryStaffScreen extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _QueryStaffScreenState();
}

class _QueryStaffScreenState extends State<QueryStaffScreen> {

  bool isHide = true;
  Map<String, String> data = {
    '工作人员姓名' : '陈垍谋',
    '联系手机' : '18775248292',
    '邮箱' : '1721554825@qq.com'
  };

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        titleSpacing: 0,
        title: SearchWidget(
          hintText: '请输入个人身份证号码进行查询',
          autofocus: true,
          onSearchCallback: (content) {
            setState(() => isHide = false);
          },
        ),
      ),
      body: Stack(
        children: <Widget>[
          Offstage(
            offstage: !isHide,
            child: Center(
              child: Text(
                '暂无记录',
                style: TextStyle(
                  fontSize: 20,
                  color: Colors.black87,
                ),
              ),
            ),
          ),
          Offstage(
            offstage: isHide,
            child: ListView(
              shrinkWrap: true,
              padding: EdgeInsets.all(32),
              children: [
                DataCard(
                  height: 175,
                  params: data,
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}